package com.hu.web.controller;

import com.hu.domain.User;
import com.hu.feignclients.UserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

//订单服务
@RestController
public class OrderController {

    @Autowired
    private UserFeignClient userFeignClient;

    //浏览器来调用
    @GetMapping("/order/user/{id}")
    public User getUserById(@PathVariable("id")Long id){
        //这里就只需要 通过Feign远程调用用户服务
        return userFeignClient.getUserById(id);
    }
}
